﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.ComponentModel;

namespace Model.Sec
{
    /// <summary>
    /// 操作权限集合类
    /// </summary>
    public class OperateCollection : IListSource
    {
        private Operate[] _Operates;
        private int _Count;
        bool IListSource.ContainsListCollection
        {
            get { return false; }
        }
        System.Collections.IList IListSource.GetList()
        {
            BindingList<Operate> ble = new BindingList<Operate>();


            foreach (Operate operate in _Operates)
            {
                ble.Add(operate);
            }


            return ble;
        }


        /// <summary>
        /// 操作类的构造函数
        /// </summary>
        /// <param name="Length">长度</param>
        public OperateCollection(int Count)
        {
            this._Count = Count;
            _Operates = new Operate[this._Count];
        }
        /// <summary>
        /// 集合的长度
        /// </summary>
        public int Count
        {
            get { return _Operates.Length; }
        }
        /// <summary>
        /// 读取或设置索引为index的Operate对象
        /// </summary>
        /// <param name="index">索引值</param>
        /// <returns>Operate对象</returns>
        public Operate this[int index]
        {
            get
            {
                return  _Operates[index];
            }
            set
            {
                _Operates[index] = value;
            }
        }
        public Operate[] operates
        {
            get { return this._Operates; }
        }
    }
}
